package main

import (
	"go_tutorial/rpc_test/new_helloworld/hanlder"
	"go_tutorial/rpc_test/new_helloworld/server_proxy"
	"net"
	"net/rpc"
)

func main() {
	//1.实例化一个server
	listener, err := net.Listen("tcp", ":1234")
	if err != nil {
		panic("连接失败")
	}
	//2.注册处理逻辑 handler
	_ = server_proxy.RegisterHelloService(&hanlder.HelloService{})
	//_ = rpc.RegisterName(hanlder.HelloServiceName, &hanlder.HelloService{})
	//3.启动服务
	for {
		conn, _ := listener.Accept()

		go rpc.ServeConn(conn)

	}
}
